import {
    service
} from './service'

export function getDetail(iid) {
    return service({
        url: '/detail',
        params: {
            iid
        }
    })
}

export function getRecommend() {
    return service({
        url: '/recommend'
    })
}

/** 商品信息数据 */
export class goods {
    constructor(itemInfo, columns, shopInfo) {
        this.title = itemInfo.title // 商品标题
        this.price = itemInfo.price // 商品现价
        this.oldPrice = itemInfo.oldPrice // 商品原价
        this.discountDesc = itemInfo.discountDesc // 优惠
        this.lowNowPrice = itemInfo.lowNowPrice
        this.discountBgColor = itemInfo.discountBgColor

        this.columns = columns

        this.services = shopInfo.services
    }
}

/** 店铺信息数据 */
export class shop {
    constructor(shopInfo) {
        this.logo = shopInfo.shopLogo // 店铺logo
        this.name = shopInfo.name // 店铺名称
        this.fans = shopInfo.cFans
        this.sells = shopInfo.cSells // 总销量
        this.score = shopInfo.score // 商家信誉
        this.goodsCount = shopInfo.cGoods // 商品总数
    }
}

/** 商品参数数据 */
export class params {
    constructor(paramsItem) {
        this.productInfo = paramsItem.info.set // 产品信息
        this.sizeInfo = paramsItem.rule.tables // 尺码信息
    }
}